package example.entity;

import example.service.UserService;

import java.util.Date;

/**
 * @author 张心怡
 * @date 2024/12/16
 */
public class Comment {
    private int id;
    private int userId;
    private int bookId;
    private Date date;
    private String message;

    private String username;

    public String getUsername() {
        return UserService.getById(userId).getUsername();
    }

    public void setUsername(String username) {
        this.username = username;
    }


    public Comment() {
    }

    public Comment(int userId, int bookId, Date date, String message) {
        this.userId = userId;
        this.bookId = bookId;
        this.date = date;
        this.message = message;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getBookId() {
        return bookId;
    }

    public void setBookId(int bookId) {
        this.bookId = bookId;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
